package com.oocl.dao.impl;




import org.springframework.stereotype.Repository;

import com.oocl.dao.ClientsDao;
import com.oocl.dao.base.BaseJPADaoUtil;
import com.oocl.entity.Clients;


@Repository("clientsDao")
public class ClientsDaoImpl extends BaseJPADaoUtil implements ClientsDao{

	
    /*
     * @Method  loadClient
     * @function loadClient for login
     * @param client Clients
     * @return c Clients
     * @author garen
     * @date 2017-8-12
     * */
	public Clients loadClient(Clients client) {
		String sql = "select c from Clients c where c.cname=:cname and c.cpwd=:cpwd";
		Clients c = (Clients) entityManager.createQuery(sql)
		                       .setParameter("cname", client.getCname())
		                       .setParameter("cpwd", client.getCpwd())
		                       .getResultList().get(0);
		return c;
	}
	
	
}
